//
//  DetailsListView.m
//  Comma
//
//  Created by dlios on 15-1-13.
//  Copyright (c) 2015年 lanou3g.com 蓝鸥科技. All rights reserved.
//

#import "DetailsListView.h"
#import "CustomTableViewCell.h"
#import "OnlyImageTableViewCell.h"
#import "OnlyTextTableViewCell.h"
#import "TextAndImageTableViewCell.h"
#import "NoTextAndImageTableViewCell.h"
#import "HiddenView.h"
#import "GlobalMacro.h"
#import "DetailsListModel.h"
#import "HiddenView.h"
#import "AFNetWorkingYU.h"
#import "URLMacro.h"
@implementation DetailsListView
- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        self.tableArray = [NSMutableArray array];
    }
    return self;
}
- (void)creatView
{
    [self.rightButton setTag:1];
    
    // 创建tableView
    self.tableView = [[UITableView alloc] initWithFrame:CGRectMake(0, 64, SCREEN_WIDTH, SCREEN_HEIGHT - 64) style:UITableViewStylePlain];
    // 五种重用池
    [_tableView registerClass:[CustomTableViewCell class] forCellReuseIdentifier:@"customCell"];
    [_tableView registerClass:[OnlyImageTableViewCell class] forCellReuseIdentifier:@"imageCell"];
    [_tableView registerClass:[OnlyTextTableViewCell class] forCellReuseIdentifier:@"textCell"];
    [_tableView registerClass:[TextAndImageTableViewCell class] forCellReuseIdentifier:@"textAndImageCell"];
    
    [self addSubview:_tableView];
    
    // 创建隐藏view
    self.hiddenView = [[HiddenView alloc] initWithFrame:CGRectMake(0, 64, SCREEN_WIDTH, 86)];
    [_hiddenView setBackgroundColor:BLACKCOLOR];
    [self addSubview:_hiddenView];
    [_hiddenView setHidden:YES];
    
    // headerView上添加分类button
    self.categoryButton = [[UIButton alloc] initWithFrame:CGRectMake(53, 33, 20, 20)];
    [_categoryButton setBackgroundImage:[UIImage imageNamed:@"app2.0png-07"] forState:UIControlStateNormal];
    [_categoryButton.layer setCornerRadius:10.0f];
    [self.headerView addSubview:_categoryButton];
    
    // headerView上添加信息button
    self.mailButton = [[UIButton alloc] initWithFrame:CGRectMake(SCREEN_WIDTH - 80, 33, 27, 27)];
    [_mailButton setBackgroundImage:[UIImage imageNamed:@"StationLetters.png"] forState:UIControlStateNormal];
    [self.headerView addSubview:_mailButton];
    
}

- (void)rightButtonAction:(id)sender
{
    UIButton *button = (UIButton *)sender;
    if (button.tag == 1) {
        [self.hiddenView setHidden:NO];
        button.tag = 2;
    } else {
        [self.hiddenView setHidden:YES];
        button.tag = 1;
    }
    [self.hiddenView setFrame:CGRectMake(0, 64, SCREEN_WIDTH, 64)];
}



/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

@end
